package com.sg.service.base.app.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.dto.base.app.req.*;
import com.sg.entity.OmsTargetObjectivePlanExtend;
import com.sg.service.base.app.MOmsTargetObjectivePlanExtendService;
import com.wicket.okrapp.common.dto.FieldInfo;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrapp.dal.mapper.mbg.OmsTargetObjectivePlanExtendMapper;
import com.wicket.okrframework.common.annotations.BanAuto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @since 2022/1/19 15:39
 */
@Service
public class MOmsTargetObjectivePlanExtendServiceImpl
        extends ServiceImpl<OmsTargetObjectivePlanExtendMapper, OmsTargetObjectivePlanExtend>
        implements MOmsTargetObjectivePlanExtendService {

    @Autowired
    OmsTargetObjectivePlanExtendMapper omsTargetObjectivePlanExtendMapper;

    /**
     * 3-3-05查指标扩展规划设置详情[2725]
     * gen by moon at 3/30/2023, 12:39:20 PM
     */
    @Trace(operationName = "3-3-05查指标扩展规划设置详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsTargetObjectivePlanExtend queryTargetObjPlanExDetail(QueryTargetObjPlanExDetailReq reqDto) {

        try {
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();
            // TODO: 2024/2/20 手续右模糊
            if (reqDto.getObjectiveCode() != null) {
                queryWrapper.likeRight("objective_code", reqDto.getObjectiveCode());
                reqDto.setObjectiveCode(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsTargetObjectivePlanExtend> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsTargetObjectivePlanExtend retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-05新增指标扩展规划设置[2814]
     * gen by moon at 10/15/2022, 10:05:14 PM
     */
    @Trace(operationName = "3-3-05新增指标扩展规划设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String addTargetObjPlanEx(OmsTargetObjectivePlanExtend omsTargetObjectivePlanExtend) {
        omsTargetObjectivePlanExtend.setObjectivePlanningExtendId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsTargetObjectivePlanExtend.setBatchEndtTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
        omsTargetObjectivePlanExtend.setIsUpdate("TRUE");
        omsTargetObjectivePlanExtend.setUpdateStatus("NEW");
        omsTargetObjectivePlanExtend.setArchivngType("NOT_ARCHIVE");
        omsTargetObjectivePlanExtend.setIsEditing("TRUE");
        omsTargetObjectivePlanExtend.setIsArchive("FALSE");
        omsTargetObjectivePlanExtend.setSubjectLifeCycle("EDITING");
        omsTargetObjectivePlanExtend.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsTargetObjectivePlanExtend.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsTargetObjectivePlanExtend.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsTargetObjectivePlanExtend.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsTargetObjectivePlanExtend.setIsValid("FALSE");
        omsTargetObjectivePlanExtend.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsTargetObjectivePlanExtend.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsTargetObjectivePlanExtend)) {
            return omsTargetObjectivePlanExtend.getObjectivePlanningExtendId();
        } else {
            return "-1";
        }

    }

    /**
     * 3-3-05删除指标扩展规划设置[2815]
     * gen by moon at 10/15/2022, 10:05:14 PM
     */
    @Trace(operationName = "3-3-05删除指标扩展规划设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteTargetObjPlanEx(String objectivePlanningExtendId) {

        return super.removeById(objectivePlanningExtendId);
    }

    /**
     * 3-3-05批量查指标扩展规划设置[2816]
     * gen by moon at 10/15/2022, 10:05:15 PM
     */
    @Trace(operationName = "3-3-05批量查指标扩展规划设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsTargetObjectivePlanExtend> batchQueryTargetObjPlanEx(BatchQueryTargetObjPlanExReq reqDto) {

        try {
            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            if (reqDto.getObjectivePlanningExtendList() == null || reqDto.getObjectivePlanningExtendList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("objective_id", reqDto.getObjectivePlanningExtendList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetObjectivePlanExtend.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetObjectivePlanExtend>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-05批量删指标扩展规划设置[2817]
     * gen by moon at 10/15/2022, 10:05:16 PM
     */
    @Trace(operationName = "3-3-05批量删指标扩展规划设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchDeleteTargetObjPlanEx(List<String> reqDto) {

        if (reqDto == null || reqDto.size() == 0) {
            return false;
        }

        return super.removeByIds(reqDto);
    }

    /**
     * 3-3-05修改指标扩展规划设置[2829]
     * gen by moon at 10/15/2022, 10:05:17 PM
     */
    @Trace(operationName = "3-3-05修改指标扩展规划设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateTargetObjPlanEx(OmsTargetObjectivePlanExtend omsTargetObjectivePlanExtend) {
        omsTargetObjectivePlanExtend.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsTargetObjectivePlanExtend.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        return super.updateById(omsTargetObjectivePlanExtend);
    }

    /**
     * 3-3-05批量增指标扩展规划设置[3454]
     * gen by moon at 10/15/2022, 10:05:17 PM
     */
    @Trace(operationName = "3-3-05批量增指标扩展规划设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchAddTargetObjPlanEx(List<OmsTargetObjectivePlanExtend> omsTargetObjectivePlanExtend) {

        if (omsTargetObjectivePlanExtend == null || omsTargetObjectivePlanExtend.size() == 0) {
            return false;
        }

        return super.saveBatch(omsTargetObjectivePlanExtend.stream().map(item -> {
            item.setObjectivePlanningExtendId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
            item.setBatchEndtTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
            item.setIsUpdate("TRUE");
            item.setUpdateStatus("NEW");
            item.setArchivngType("NOT_ARCHIVE");
            item.setIsEditing("FALSE");
            item.setIsArchive("FALSE");
            item.setSubjectLifeCycle("EDITING");
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setIsValid("FALSE");
            item.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            item.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            return item;
        }).collect(Collectors.toList()));
    }

    /**
     * 3-3-05查询指标扩展规划设置列表[3650]
     * gen by moon at 10/15/2022, 10:05:18 PM
     */
    @Trace(operationName = "3-3-05查询指标扩展规划设置列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsTargetObjectivePlanExtend> queryTargetObjPlanExList(QueryTargetObjPlanExListReq reqDto) {

        try {
            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetObjectivePlanExtend.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetObjectivePlanExtend>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-05批量改指标扩展规划设置[3651]
     * gen by moon at 1/16/2023, 6:04:08 PM
     */
    @Trace(operationName = "3-3-05批量改指标扩展规划设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    @BanAuto
    public boolean batchUpdateTargetObjPlanEx(List<OmsTargetObjectivePlanExtend> omsTargetObjectivePlanExtend) {

        if (omsTargetObjectivePlanExtend == null || omsTargetObjectivePlanExtend.size() == 0) {
            return false;
        }
        // TODO: 2023/1/16 此处为验证，不要合
        return super.updateBatchById(omsTargetObjectivePlanExtend);

    }

    /**
     * M3-构造单条指标规划扩展设置验证数据[4308]
     * gen by moon at 10/15/2022, 10:05:20 PM
     */
    @Trace(operationName = "M3-构造单条指标规划扩展设置验证数据")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String buildSingleTargetObjPlanExtend(OmsTargetObjectivePlanExtend omsTargetObjectivePlanExtend) {
        omsTargetObjectivePlanExtend.setObjectivePlanningExtendId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsTargetObjectivePlanExtend.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsTargetObjectivePlanExtend.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        if (omsTargetObjectivePlanExtend != null && omsTargetObjectivePlanExtend.getSubjectLifeCycle() != null && omsTargetObjectivePlanExtend.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsTargetObjectivePlanExtend.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
        }
        if (omsTargetObjectivePlanExtend != null && omsTargetObjectivePlanExtend.getSubjectLifeCycle() != null && omsTargetObjectivePlanExtend.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsTargetObjectivePlanExtend.setArchiveInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//ARCHIVE_CURRENT_INDUCTIONID
        }
        omsTargetObjectivePlanExtend.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsTargetObjectivePlanExtend.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsTargetObjectivePlanExtend.setReleaseTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsTargetObjectivePlanExtend.setArchiveTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsTargetObjectivePlanExtend.setIsValid("FALSE");
        omsTargetObjectivePlanExtend.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsTargetObjectivePlanExtend.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsTargetObjectivePlanExtend)) {
            return omsTargetObjectivePlanExtend.getObjectivePlanningExtendId();
        } else {
            return "-1";
        }

    }

    /**
     * M3-查询指标规划扩展设置列表[4368]
     * gen by moon at 10/15/2022, 10:05:21 PM
     */
    @Trace(operationName = "M3-查询指标规划扩展设置列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsTargetObjectivePlanExtend> queryTargetObjPlanExtendList(OmsTargetObjectivePlanExtend omsTargetObjectivePlanExtend) {

        try {
            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();


            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(omsTargetObjectivePlanExtend);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetObjectivePlanExtend.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetObjectivePlanExtend>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-05查询单条指标规划扩展设置详情[4399]
     * gen by moon at 3/30/2023, 12:39:21 PM
     */
    @Trace(operationName = "3-3-05查询单条指标规划扩展设置详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsTargetObjectivePlanExtend querySingleTargetObjPlanExtendDetail(QuerySingleTargetObjPlanExtendDetailReq reqDto) {

        try {
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsTargetObjectivePlanExtend> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsTargetObjectivePlanExtend retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3-3-05删除单条指标规划扩展设置[4417]
     * gen by moon at 10/15/2022, 10:05:22 PM
     */
    @Trace(operationName = "M3-3-05删除单条指标规划扩展设置")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteSingleTargetObjPlanExtend(String objectivePlanningExtendId) {

        return super.removeById(objectivePlanningExtendId);
    }

    /**
     * M3查询指标扩展设置测试列表[6261]
     * gen by moon at 4/15/2023, 1:10:24 AM
     */
    @Trace(operationName = "M3查询指标扩展设置测试列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsTargetObjectivePlanExtend> queryTargetObjPlanExListTestList(QueryTargetObjPlanExListTestListReq reqDto) {

        try {
            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();


            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetObjectivePlanExtend.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetObjectivePlanExtend>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-05查询评价模板下指标扩展列表[8918]
     * gen by moon at 3/30/2024, 12:53:02 AM
     */
    @Trace(operationName = "3-3-05查询评价模板下指标扩展列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsTargetObjectivePlanExtend> queryEvaTempObjectiveExtendList(QueryEvaTempObjectiveExtendListReq reqDto) {

        try {
            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetObjectivePlanExtend.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetObjectivePlanExtend.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetObjectivePlanExtend>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-05查询指标扩展设置详情[9246]
     * gen by moon at 4/4/2024, 10:02:57 AM
     */
    @Trace(operationName = "3-3-05查询指标扩展设置详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsTargetObjectivePlanExtend queryObjtiveExtSetDetail(QueryObjtiveExtSetDetailReq reqDto) {

        try {

            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsTargetObjectivePlanExtend> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsTargetObjectivePlanExtend retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-05查询指标扩展设置详情[9413]
     * gen by moon at 4/19/2024, 8:08:24 PM
     */
    @Trace(operationName = "3-3-05查询指标扩展设置详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsTargetObjectivePlanExtend queryObjectiveExtendDetail(QueryObjectiveExtendDetailReq reqDto) {

        try {

            QueryWrapper<OmsTargetObjectivePlanExtend> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsTargetObjectivePlanExtend> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsTargetObjectivePlanExtend retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }
}
